home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 June / EnigmA AMIGA RUN 19 (1997)(G.R. Edizioni)(IT)[!][issue 1997-06][EAR-CD III].iso / imagestudio / imagestudio68000 / rexx / toicon.isrx < prev   
Text File  |  1995-02-24  |  3KB  |  129 lines

  1. /* ImageStudio ARexx script **************************************/
  2.  
  3. /* Allow commands to return results */
  4.  
  5. options results
  6.  
  7. /* On error, goto ERROR:. Comment out this line if you wish to */
  8. /* perform your own error checking. */
  9.  
  10. signal on error
  11.  
  12. /* BEGIN PROGRAM *************************************************/
  13.  
  14. /* See if we have an image already */
  15.  
  16. IMAGEINFO_GET STEM imageinfo.
  17.  
  18. if imageinfo.changed == 1 then do
  19.     REQUEST_MESSAGE TEXT '"Project has changed, continue?"',
  20.         BUTTONTEXT '"OK|Cancel"' AUTOCANCEL
  21.  
  22.     end
  23. else if imageinfo.changed == -1 then do
  24.  
  25.     /* Open a filerequester to get an image to operate on */
  26.  
  27.     REQUEST_FILE TITLE '"Choose image..."' VAR imagefile
  28.  
  29.     OPEN FILE '"'imagefile'"'
  30.  
  31.     end
  32.  
  33. /* Remap the image to Workbench palette */
  34.  
  35. REQUEST_MESSAGE TEXT '"Use default Workbench palette?"',
  36.     BUTTONTEXT '"Yes|No|Cancel"' AUTOCANCEL
  37.  
  38. if result == 1 then
  39.     palettefile = 'Palettes/Workbench4.palette'
  40. else
  41.     REQUEST_FILE TITLE '"Choose palette..."' PATHPART '"Palettes"',
  42.         VAR palettefile
  43.  
  44. /* Ask whether should dither */
  45.  
  46. REQUEST_MESSAGE TEXT '"Dither image?"' BUTTONTEXT '"Yes|No|Cancel"',
  47.     AUTOCANCEL
  48.  
  49. if result == 1 then
  50.     ditherarg = 'DITHER "FS"'
  51. else
  52.     ditherarg = ''
  53.  
  54. /* Scale the image to 80 x 40 */
  55.  
  56. SCALE X 80 Y 40
  57.  
  58. /* Load and apply the palette */
  59.  
  60. PALETTE_LOAD FILE '"'palettefile'"' ditherarg
  61.  
  62. /* Copy to clipboard, ready for IconEdit ? */
  63.  
  64. REQUEST_MESSAGE TEXT '"Copy to clipboard?"' BUTTONTEXT '"Yes|No"'
  65.  
  66. if result == 1 then
  67.     COPY
  68.  
  69. /* END PROGRAM ***************************************************/
  70.  
  71. exit
  72.  
  73. /* On ERROR */
  74.  
  75. ERROR:
  76.  
  77. /* If we get here, either an error occurred with the command's */
  78. /* execution or there was an error with the command itself. */
  79. /* In the former case, rc2 contains the error message and in */
  80. /* the latter, rc2 contains an error number. SIGL contains */
  81. /* the line number of the command which caused the jump */
  82. /* to ERROR: */
  83.  
  84. if datatype(rc2,'NUMERIC') == 1 then do
  85.     /* See if we can describe the error with a string */
  86.  
  87.     select
  88.         when rc2 == 103 then
  89.             err_string = "ERROR 103, "||,
  90.                 "out of memory at line "||SIGL
  91.         when rc2 == 114 then
  92.             err_string = "ERROR 114, "||,
  93.                 "bad command template at line "||SIGL
  94.         when rc2 == 115 then
  95.             err_string = "ERROR 115, "||,
  96.                 "bad number for /N argument at line "||SIGL
  97.         when rc2 == 116 then
  98.             err_string = "ERROR 116, "||,
  99.                 "required argument missing at line "||SIGL
  100.         when rc2 == 117 then
  101.             err_string = "ERROR 117, "||,
  102.                 "value after keywork missing at line "||SIGL
  103.         when rc2 == 118 then
  104.             err_string = "ERROR 118, "||,
  105.                 "wrong number of arguments at line "||SIGL
  106.         when rc2 == 119 then
  107.             err_string = "ERROR 119, "||,
  108.                 "unmatched quotes at line "||SIGL
  109.         when rc2 == 120 then
  110.             err_string = "ERROR 120, "||,
  111.                 "line too long at line "||SIGL
  112.         when rc2 == 236 then
  113.             err_string = "ERROR 236, "||,
  114.                 "unknown command at line "||SIGL
  115.         otherwise
  116.             err_string = "ERROR "||rc2||", at line "||SIGL
  117.         end
  118.         end
  119. else if rc2 == 'RC2' then do
  120.     err_string = "ERROR in command at line "||SIGL
  121.     end
  122. else do
  123.         err_string = rc2||", line "||SIGL
  124.         end
  125.  
  126. request_message TEXT '"'err_string'"'
  127.  
  128. exit
  129.